package interview.test1;

public class DrinkCola {
	public static void main (String[] args){
		
		System.out.println(DrinkCola.sum(33, 0));
		System.out.println(DrinkCola.Soda(33, 0));
		long maxMemory = Runtime.getRuntime().maxMemory();//返回Java虚拟机试图使用的最大内存量。  
        Long totalMemory = Runtime. getRuntime().totalMemory();//返回Java虚拟机中的内存总量。  
        System.out.println("MAX_MEMORY ="+maxMemory +"(字节)、"+(maxMemory/(double)1024/1024) + "MB");  
        System.out.println("TOTAL_ MEMORY = "+totalMemory +"(字节)"+(totalMemory/(double)1024/1024) + "MB");  
		System.out.println(Math.round(11.5));
		System.out.println(Math.round(-11.5));
		
		
		
		
		
		
		
	}

	public static int Soda(int drinks,int bottles){
        bottles%=3;
        bottles+=drinks;
        if(bottles<3){
            return drinks;
        }
        else{
            return Soda(bottles/3,bottles)+drinks;
        }
    }
	
	public static int sum(int drink,int shengPing){    
        int ping=drink+shengPing;
     
        if(ping/3==0){
            return drink;
        }
        return drink+sum(ping/3,ping%3);

    }
}
